package bsts.view.user;

import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JPanel;

import bsts.application.BSTSApplication;

public class SubscriptionTabPanel extends JPanel {

	private static final long serialVersionUID = 1L;

	private BSTSApplication manager;
	private JPanel pnlMain;

	private JButton btnNewSubscription;
	private JButton btnUpdSubscription;

	private ActionListener actlis_btnNewSubscription;
	private ActionListener actlis_btnUpdSubscription;

	public SubscriptionTabPanel(BSTSApplication manager) {
		this.manager = manager;

		pnlMain = new JPanel();
		pnlMain.setLayout(new GridLayout(9, 1, 0, 10));

		btnNewSubscription = new JButton("New Subscription");
		btnUpdSubscription = new JButton("Update Subscription");

		pnlMain.add(btnNewSubscription);
		pnlMain.add(btnUpdSubscription);
		this.add(pnlMain);

		initActionListener();
	}

	private void initActionListener() {
		actlis_btnNewSubscription = new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				manager.getViewManager().showViewCustomersWindowForSubscriptions();
				manager.getViewManager().setSubscriptionCreateSelectionStatus();
			}
		};

		actlis_btnUpdSubscription = new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				manager.getViewManager().showViewCustomersWindowForSubscriptions();
				manager.getViewManager().setSubscriptionUpdateSelectionStatus();
			}
		};

		btnNewSubscription.addActionListener(actlis_btnNewSubscription);
		btnUpdSubscription.addActionListener(actlis_btnUpdSubscription);
	}

}
